<extend name="Public:mainbase" />
<block name="content">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/dhtmlxtree.css"/>
    <script language="javascript" src="__PUBLIC__/js/member.js?{:time()}"></script>
    <script language="javascript" src="__PUBLIC__/js/Validform_v5.3.2_min.js?{:time()}"></script>
    <style type="text/css">
        .Validform_checktip{line-height: 34px}
        #issueModal ul{font-size: 16px;cursor:pointer;}
    </style>
    <!--  内容列表   -->
    <form name="form2" method="post">
        <table width="98%" class="table table-bordered  table-hover table-condensed "  align="center">
            <tr bgcolor="#E7E7E7" >
                <td height="28" colspan="11" background="__PUBLIC__/images/tbg.gif" style="padding-left:10px;">
                    ◆ 文稿列表 &nbsp;&nbsp;&nbsp;&nbsp;<!--<button type="button" class="btn btn-xs btn-warning" data-toggle="modal" data-target=".newarticlebox"><i class="glyphicon glyphicon-plus"></i> 添加文稿</button>-->
                </td>
            </tr>
            <tr align="center" bgcolor="#FBFCE2" height="25">
                <td width="4%">选择</td>
                <td width="10%">组ID</td>
                <td>直播标题</td>
                <td>申请人</td>
                <td>开始时间</td>
                <td>申请时间</td>
                <td>直播状态</td>
                <td>审核状态</td>
                <td width="10%">操作</td>
            </tr>
            <foreach name="liveList" item="val">
                <tr align='center' bgcolor="#FFFFFF" height="26">
                    <td>
                        <input name="gid" type="checkbox" value="{$val.group_id}" class="np" />
                    </td>
                    <td nowrap>{$val.group_id}</td>
                    <td><a href="{:U('liveInfo',array('group_id'=>$val['group_id']))}">{$val.title}</a></td>
                    <td>{$val.realname}</td>
                    <td>{$val.start_time|myDate="Y-m-d H:i",###}</td>
                    <td>{$val.create_time|myDate="Y-m-d H:i",###}</td>
                    <td>
                        <switch name="val.group_status">
                            <case value="0">无</case>
                            <case value="1"><img src="__PUBLIC__/images/status-red.png"  height="12" alt=""> 待直播</case>
                            <case value="2"><img src="__PUBLIC__/images/status-gray.png" height="12" alt=""> 直播中</case>
                            <case value="3"><img src="__PUBLIC__/images/status-gray.png" height="12" alt=""> 直播结束</case>
                        </switch>
                    </td>
                    <td>
                        <switch name="val.v_status">
                            <case value="-1"><span style='color:#ccc'>草稿</span></case>
                            <case value="0"><span style='color:blue'>待审核</span></case>
                            <case value="1"><span style='color:green'>审核通过</span></case>
                            <case value="2"><span style='color:gray'>审核中</span></case>
                            <case value="3"><span style='color:red'>打回</span></case>
                        </switch>
                    </td>
                    <td>


                        <!-- <a href="javascript:;" data-aid='{$val.id}' class='push'>推送</a>
                        | -->

                        <switch name="val.v_status">
                            <case value="-1">
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=0" class='verify'>重新发布</a>
                            </case>
                            <case value="0">
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=1" class='verify'>通过</a>
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=3" class='verify'>打回</a>
                            </case>
                            <case value="1">

                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=3" class='verify'>打回</a>
                                |

                                <a href="javascript:;" data-gid='{$val.group_id}' class='issue'>签发</a>
                            </case>
                            <case value="2">
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=1" class='verify'>通过</a>
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=3" class='verify'>打回</a>
                            </case>
                            <case value="3">
                                |
                                <a href="{:U('verify')}?id={$val.group_id}&state=0" class='verify'>重新发布</a>
                            </case>
                        </switch>

                        |

                        <a href="javascript:;" data-gid='{$val.group_id}' class='delLive'>删除</a>
                    </td>
                </tr>
            </foreach>
            <tr bgcolor="#ffffff">
                <td height="36" colspan="11">
                    &nbsp;
                    <a href="javascript:selAll()" class="btn btn-xs btn-info"><i class='glyphicon glyphicon-ok'></i> 全选</a>
                    <a href="javascript:noSelAll()" class="btn btn-xs btn-info"><i class='glyphicon glyphicon-remove'></i> 取消</a>
                    <!-- <a href="javascript:checkArc(0)" class="btn btn-xs btn-info">&nbsp;审核&nbsp;</a> -->
                    <a href="javascript:;" id="delLiveAll" class="btn btn-xs btn-info"><i class="glyphicon glyphicon-trash"></i> 删除</a>
                </td>
            </tr>
    </form>
    <tr align="right" bgcolor="#F9FCEF">
        <td height="36" colspan="11" align="center">
            <div class='page'>{$showpage}</div>
        </td>
    </tr>
    </table>

      搜索表单
    <form name='form3' action='' method='get'>
    <input type='hidden' name='dopost' value='listArchives' />
    <table width='98%'  class='table' align="center" style="margin-top:8px">
        <tr bgcolor='#EEF4EA'>
            <td background='__PUBLIC__/images/wbg.gif' align='center'>
                <table border='0' cellpadding='0' cellspacing='0' height="32">
                    <tr>
                        <td nowrap>直播标题：</td>
                        <td width='130'>
                            <input type='text' name='title' value='' style='width:120px' />
                        </td>
                    <td nowrap>用户名：</td>
                    <td width='130'>
                        <input type='text' name='username' value='' style='width:120px' />
                    </td>
                    <td>
                        <input name="imageField" type="image" src="__PUBLIC__/images/button_search.gif" width="60" height="22" border="0" class="np" />
                    </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </form>

    <div class="modal fade " tabindex="-1" role="dialog" aria-labelledby="issueModal" id="issueModal">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">选择一个栏目</h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" value="" id="gid">
                    <ul class="list-group">
                        <volist name="columeList" id="colume">
                            <li class="list-group-item" data-id="{$colume.id}">{$colume.name}</li>
                        </volist>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary sureBTN">确定</button>
                </div>
            </div><!-- /.modal-content -->
        </div>
    </div>

    <style type="text/css">
        .editarticlebox{ z-index: 900 !important; }
        .modal-backdrop{z-index: 800 !important; }
    </style>
    <script type="text/javascript">

        $('.delLive').click(function(){
            if(confirm('是否确定删除此直播？')){
                var obj=this;
                $.get('{:U("ajaxDelLive")}?id='+$(obj).data('gid'),function(data){
                    if(data.status==1){
                        $(obj).parents('tr').remove();
                    }
                })
            }
        })

        $('#delLiveAll').click(function(){
            if(confirm('是否确定删除？')){
                var id=$('[name=gid]:checked').map(function(){
                    return $(this).val();
                }).get().join()

                $.get('{:U("ajaxDelLive")}?id='+id,function(data){
                    if(data.status==1){
                        $('[name=gid]:checked').parents('tr').remove();
                    }
                })
            }
        })

        function selAll(){
            $('[name=gid]').each(function(){
                this.checked=true;
            })
        }
        function noSelAll(){
            $('[name=gid]').each(function(){
                this.checked=false;
            })
        }

        $(".issue").click(function(){
            $("#issueModal").modal('show');
            $('#issueModal #gid').val($(this).data('gid'));
        })

        $("#issueModal").on('hidden.bs.modal', function (e) {
            $('#issueModal .list-group-item').removeClass('active');
            $('#issueModal #gid').val('');
        })

        $('#issueModal .list-group-item').hover(function(){
            $(this).addClass('list-group-item-info');
        },function(){
            $(this).removeClass('list-group-item-info')
        }).click(function(){
            $(this).addClass('active').siblings('.active').removeClass('active');
        })

        $('#issueModal .sureBTN').click(function(){
            var cid=$('#issueModal .active').data('id');
            var gid=$("#gid").val();
            $.getJSON('{:U("ajaxIssueColumn")}',{cid:cid,gid:gid},function(data){
                if(data.resultCode==1){
                    alert(data.info);
                }else{
                    alert(data.info);
                    $("#issueModal").modal('hide');
                }
            })
        })


    </script>

</block>